package com.ant.storage.utils;//package com.ant.storage.utils;
//
//import org.springframework.stereotype.Component;
//
//import javax.servlet.*;
//import javax.servlet.annotation.WebFilter;
//import javax.servlet.http.HttpServletRequest;
//import java.io.IOException;
//import java.util.Enumeration;
//
///**
// * @author hzd
// * @version 1.0
// * @date 2022/3/22 14:56
// */
//@Component
//@WebFilter(urlPatterns = "/api/*", filterName = "channelFilter")
//public class ChannelsFilter implements Filter{
//    @Override
//    public void init(FilterConfig filterConfig) {
//
//    }
//    @Override
//    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
//        ServletRequest requestWrapper = null;
//        if (servletRequest instanceof HttpServletRequest) {
//            //关注点
//            String token = ((HttpServletRequest) servletRequest).getHeader("Token");
//            System.out.println(token);
//            if (servletRequest.getContentType().equals("application/json")) {
//                requestWrapper = new RequestWrapper((HttpServletRequest) servletRequest);
//            }
//        }
//        if (requestWrapper == null) {
//            filterChain.doFilter(servletRequest, servletResponse);
//        } else {
//            filterChain.doFilter(requestWrapper, servletResponse);
//        }
//    }
//    @Override
//    public void destroy() {
//    }
//
//}
